<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<META NAME="GENERATOR" CONTENT="Adobe FrameMaker 7.0/HTML Export Filter">
<LINK REL="STYLESHEET" HREF="KDM_1.0_p3_resources.css" CHARSET="ISO-8859-1" TYPE="text/css">
<TITLE> 	Part 3. Runtime Resources Layer</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<DIV>
<H6 CLASS="Heading">
<A NAME="pgfId-1096814"></A>Part 3. Runtime Resources Layer</H6>
<P CLASS="Body">
<A NAME="pgfId-1097065"></A>This chapter describes common patterns for representing the operating environment of existing software systems.</P>
<P CLASS="Body">
<A NAME="pgfId-1097175"></A>The following are the common properties of the Resource Layer packages Data, UI, Platform, and Event:</P>
<UL>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097176"></A>They provide modeling elements to represent &quot;resources&quot; (something managed by the runtime platform)</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097177"></A>They provide abstract &quot;resource actions&quot; to manage these resources</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097178"></A>These actions are implemented by the program elements as one or more API calls to some external platform-specific packages</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097179"></A>There is a binding involved between the actions and the resources</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097180"></A>Resource may involve some &quot;inverted&quot; control in the form of callbacks and event handlers, allowing applications to be programmed in event-driven style</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097181"></A>The content of the information flow involving the resource is associated with some data organization</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097182"></A>Resource often has a certain state, and tracking the changes of the state over time may be an important concern in understanding the logic of the existing system</LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId-1097183"></A>Since Resource Layer packages capture high-value knowledge about the existing system and its operating environment, which may involve advance analysis and some manual expertise KDM is design is such a way that the Resource level analysis can use KDM models from the Platform Elements Layer as input and produce Resource Layer models as output. There should be no references from lower KDM layers to higher layers; therefore new Resource Layer models can be built on top of existing Program Element layer models.</P>
<P CLASS="Body">
<A NAME="pgfId-1097184"></A>Resource layer package systematically use the following few KDM patterns:</P>
<UL>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097185"></A>Each Resource Layer package defines entities and containers to represent specific &quot;resources&quot;. Each package may define additional elements to represent additional concerns. For example, the Data package involves less resource definitions, and focuses on the representation of various data organization capabilities. The Event package provides the meta-model elements for representing state, state transitions caused by events. States, transitions and events can be considered as runtime platform resources. The UI package provides the meta-model elements for representing user interfaces. User interfaces can also be considered runtime platform resources. The Platform package deal with conventional runtime platform resources, such as inter-process communication, the use of registries, management of data, etc.</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097186"></A>Each Resource Layer package defines specific structural relations between &quot;resources&quot;. For example, the Platform package defines relationship BindsTo which represents a logical association between two resources.</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097187"></A>Each Resource Layer package defines specific resource actions to represent manipulation of resource through API calls. Resource actions use the following KDM pattern. Each resource action is an entity of the base abstract class for the corresponding package. This class is named AbstractXXXElement, where &quot;XXX&quot; is the name of the package. So, the resource action is not a subclass of ActionElement, and this promotes modularity between Resource Layer packages, each of which defines as independent KDM compliance point. However, each resource action owns one or more ActionElement through property called &quot;abstraction&quot;. Each resource action also has the property called &quot;implementation&quot; which uses the KDM grouping mechanism to associate the resource action with one or more ActionElement owned by the Code model. The &quot;implementation&quot; group of the resource action represents the original API calls as they were represented in the Program Elements layer input model. The &quot;abstraction&quot; property uses KDM container mechanism to add the behavior counterparts to the API calls that represent the true logic of the resource operation, including the flow of data and control. The &quot;abstracted&quot; ActionElements are owned directly by the corresponding resource action, and are not part of any Code model.</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097188"></A>The nature of the resource-specific operation performed by a particular resource action is represented by the &quot;kind&quot; attribute of the resource actions. The resource action owns resource action relations through the &quot;abstraction&quot; action container. It is the owned &quot;abstracted&quot; action that is the direct owner of the resource action relationship.</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097189"></A>&quot;abstraction&quot; action container property is in fact systematically added to all elements of Resource Layer packages. This way each resource can use the meta-model elements defined in the Program Elements layer to specify behavior specific to that resource</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097190"></A>The &quot;abstraction&quot; action container pattern is used to systematically represent the forms of &quot;inverted&quot; control provided by runtime platforms. This pattern can be separately referred to as the KDM Event pattern. Each Resource Layer package defines own meta-model element for representing events. For example, the UI package defines the class UIEvent. The &quot;abstraction&quot; action container mechanism allow ActionElements to be added to event elements. Calls relation originating from such abstracted action element represents the &quot;callback&quot; mechanism, provided by several runtime platforms.</LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId-1097191"></A>Resource Layer packages are independent, however they can offer additional capabilities, when more than one is implemented. In order not to enforce any particular order in which these packages should be implemented, KDM involves the following approach: resource action relationships are subclasses of the AbstractActionRelationship class from the Action Package. In the full KDM implementation that uses all packages, all resource actions are available for any ActionElement. Code models should not use the extended relationships. The extended resource action relationships can only be used by the actions in &quot;abstraction&quot; action containers in Resource Layer models. A notable example of this mechanism are the actions &quot;HasState&quot; defined in the Event package, which makes it possible to associate an element of an event model with any resource. Another example is the &quot;HasContent&quot; relation defined in the Data package which allows associating an element of a data model with any resource.</P>
<UL>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097192"></A>The &quot;abstraction&quot; action containers, available for each resource also allow arbitrary Flow relations between &quot;resource actions&quot; and between resources to provide abstractions of the flow between &quot;resource actions&quot;</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097193"></A>The Resource Layer patterns are aligned the micro KDM, which allow precise modeling of behavior related to resources as the foundation for holistic high-fidelity analysis of existing software systems. Is can be achieved by associating sets of precise micro KDM actions with &quot;abstraction&quot; action containers. </LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId-1097077"></A>Additional Runtime concerns involve dynamic structures (instances of some logical entities and their relationships) that emerge at the so-called &quot;run time&quot; of the software system. For example, dynamic entities include processes and threads. Instances of processes and threads can be created dynamically and in many cases relations between the dynamically created instances of processes and threads are essential part of the knowledge of existing system. Pure logical perspective in that case may be insufficient.</P>
<P CLASS="Body">
<A NAME="pgfId-1097078"></A>When separation of concerns between application code and Runtime platform is considered, it is important to be clear about the so-called bindings and various mechanisms to achieve a binding or delay it.</P>
<P CLASS="Body">
<A NAME="pgfId-1097079"></A>A binding is a common way of referring to a certain irrevocable implementation decision. Too much binding is often referred to as &quot;hardcoding&quot;. This often results in systems that are difficult to maintain and reuse. They are often also difficult to understand. Too little binding leads to dynamic systems, where everything is resolved at run time (as late as possible). This often results in systems that are difficult to understand and error-prone. Modern platforms excel in managing binding time. Usually binding is managed at deployment time.</P>
<P CLASS="Body">
<A NAME="pgfId-1097083"></A>Large number of software development practices is about efficient management of binding time, including portable adaptors, code generation, model-driven architecture. Efficient management of binding time is often called platform independence.</P>
<P CLASS="Body">
<A NAME="pgfId-1097085"></A>Binding time</P>
<UL>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097086"></A>Generation time binding</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097087"></A>Language &amp; platform design binding</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097088"></A>Versioning time</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097089"></A>Compile time binding, including</LI>
<LI CLASS="Bullet2">
<A NAME="pgfId-1097090"></A>macro expansion</LI>
<LI CLASS="Bullet2">
<A NAME="pgfId-1097091"></A>Templates</LI>
<LI CLASS="Bullet2">
<A NAME="pgfId-1097092"></A>Product line variants defined by conditional compilation</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097093"></A>Link time binding</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097094"></A>Deployment time binding</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097095"></A>Initialization time binding</LI>
<LI CLASS="Bullet1">
<A NAME="pgfId-1097096"></A>Run time</LI>
</UL>
<P CLASS="Body">
<A NAME="pgfId-1097170"></A>&nbsp;</P>
<TABLE BORDER="1">
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<H6 CLASS="TableTitle">
<A NAME="pgfId-1097099"></A>Binding Time</H6>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<H6 CLASS="TableTitle">
<A NAME="pgfId-1097101"></A>What is being bound</H6>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<H6 CLASS="TableTitle">
<A NAME="pgfId-1097103"></A>Result</H6>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097105"></A>Generation time</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097107"></A>Syntax, variant, pattern, mapping, etc.</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097109"></A>Generated code</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097111"></A>Language &amp; platform design</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097113"></A>Syntax, entities and relations, including platform resource types</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097115"></A>Source code</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097117"></A>Versioning</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097119"></A>Module source files</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097121"></A>Module version</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097123"></A>Compile time</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097125"></A>Intra-module relations (def-use)</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097127"></A>Module</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097129"></A>--    Macro</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097131"></A>Syntax, macro to expanded code</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097133"></A>Expanded macro (source code)</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097135"></A>--    Template</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097137"></A>Template parameters</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097139"></A>Template instance</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097141"></A>--    Product line variant   defined by conditional compilation and includes</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097143"></A>Conditional compilation, macro, includes, symbolic links</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097145"></A>Component Variant</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097147"></A>(static) Link time</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097149"></A>Intra-component relations within deployable component</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097151"></A>Deployed Component</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097153"></A>Deployment time</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097155"></A>Resource names to resources (using platform-specific configuration files)</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097157"></A>Deployed System</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097159"></A>Initialization time</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097161"></A>Component implementation to component interface; major processes and threads; dynamic linking, dynamic load (using platform-specific configuration files)</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097163"></A>System</P>
</TD>
</TR>
<TR>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097165"></A>Run time</P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097167"></A>User input, object factory, virtual function, function pointer, reflection, instances of processes, instances of objects, instances of data, etc. </P>
</TD>
<TD ROWSPAN="1" COLSPAN="1">
<P CLASS="TableText">
<A NAME="pgfId-1097169"></A>Particular Execution Path</P>
</TD>
</TR>
</TABLE>
<P CLASS="Body">
<A NAME="pgfId-1096959"></A>&nbsp;</P>
</DIV>
</BODY>
</HTML>
